 //Alter et al replication file for Figure 8
 // November 2019
 log using "/Users/boogaloo/Dropbox/Wikipedia Study/PublicationProcess/Final Submission/alter_figure8_log.smcl", replace
 //cd "/Users/boogaloo/Dropbox/Wikipedia Study/jean_file/final_figures"
 cd "/Users/boogaloo/Dropbox/Wikipedia Study/PublicationProcess/Final Submission"
 use "/Users/boogaloo/Dropbox/Wikipedia Study/jean_file/final_figures/Alter_et_al_final_dataset.dta", clear
 
 label define status 0 "Absent" 1 "Committee" 2 "Officer" 3 "Leader/Honor"
 label values status_3 status
 label values status_3sec status
 label values status_3 status
 label define Gender 0 "Women" 1 "Men"
 label values gender Gender
 label variable gender "Gender"

 //encode b_typeinstitution if b_typeinstitution!="NA", generate(b_typeinst)
 gen tt_many_pubs=0
 replace tt_many_pubs=1 if tt_num_publications>2
 
 gen status_23_01=.
replace status_23_01=0 if num_status_3==0 & num_status_2==0
replace status_23_01=1 if num_status_3>0 & num_status_3!=.
replace status_23_01=1 if num_status_2>0 & num_status_2!=.

replace tt_num_publications=0 if tt_num_publications==.
 
 //rename journals to something more informative
 label variable s_editor "s_editor.ajps"
 label variable s_editor_3 "s_editor.poq"
 label variable s_editor_in_chief_2 "s_editor.in.chief.PA"
 label variable s_editor_6 "s_editor.APR"
 label variable s_chair "s_chair_WP"
 label variable s_editor_2 "s_editor.JCR"
 label variable s_editor_in_chief "s_editor.in.chief.IO"
 label variable s_editors "s_editors.CPS"
 label variable s_editors_in_chief "s_editors.in.chief.CP"
 
 // analysis on status - focus on who is serving/how much
 reg sec_pos_total  i.gender c.tt_num_publications i.status_3sec 
outreg2 using alter_table8.doc, replace ctitle(Combined Dataset) alpha(0.001, 0.01, 0.05)
 margins i.gender
 marginsplot,  recast(bar) title(Combined dataset) ytitle( Section Leadership (Predicted Avg.)) ylabel(0(0.05)0.20) scheme(s1mono)  
  graph export alter_fig8a.tif, replace
	graph export alter_fig8a.png, replace
 reg sec_pos_total  i.gender c.tt_num_publications i.status_3sec if b_baseline==1 & b_positioncat!=5
 outreg2 using alter_table8.doc, append ctitle(Baseline Only) alpha(0.001, 0.01, 0.05)
 margins i.gender
 marginsplot, recast(bar) title(Baseline dataset) ytitle( Section Leadership (Predicted Avg.)) ylabel(0(0.05)0.20) scheme(s1mono)  
  graph export alter_fig8b.tif, replace
  graph export alter_fig8b.png, replace
 
 



  
  ///////////////// Appendix 

// A4, T1:  
    // logit analysis: gender overall
 logit status01  i.gender  
 outreg2 using alter_A4_table1.doc, replace ctitle(Combined Dataset) alpha(0.001, 0.01, 0.05)
 logit status01 i.gender  if b_baseline==1 & b_positioncat!=5
 outreg2 using alter_A4_table1.doc, append ctitle(Baseline Dataset) alpha(0.001, 0.01, 0.05)


    //appendix 4 table 2
 mlogit status_3 i.gender   
 outreg2 using alter_A4_table_2_multinomial_tt1.doc, replace ctitle(Combined Dataset) alpha(0.001, 0.01, 0.05)

 mlogit status_3 i.gender  if b_baseline==1 & b_positioncat!=5
 outreg2 using alter_A4_table_2_multinomial_tt1.doc, append ctitle(Baseline Dataset) alpha(0.001, 0.01, 0.05)
 
     //appendix 4 table 3
 mlogit status_3sec i.gender   
 outreg2 using alter_A4_table_2_multinomial_tt2.doc, replace ctitle(Combined Dataset) alpha(0.001, 0.01, 0.05)

 mlogit status_3sec i.gender  if b_baseline==1 & b_positioncat!=5
 outreg2 using alter_A4_table_2_multinomial_tt2.doc, append ctitle(Baseline Dataset) alpha(0.001, 0.01, 0.05)
 
 
 //appendix 4 table 4
 ologit status_3 i.gender   
 outreg2 using alter_A4_table_2_ologit_tt1.doc, replace ctitle(Combined Dataset) alpha(0.001, 0.01, 0.05)

 ologit status_3 i.gender  if b_baseline==1 & b_positioncat!=5
 outreg2 using alter_A4_table_2_ologit_tt1.doc, append ctitle(Baseline Dataset) alpha(0.001, 0.01, 0.05)
 
 
 log close
  
 
